@extends('admin.base')
    @section('content')
	 
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            类别信息输出表
            <small>preview of simple tables</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">类别信息</a></li>
            <li class="active">列表</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
          <div class="row">
            <div class="col-md-12">
              <div class="box">
                <div class="box-header with-border">
                  <h3 class="box-title"><i class="fa fa-th"></i> 类别信息管理</h3>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <table class="table table-bordered">
                    <tr>
                      <th style="width:60px">类别id号</th>
                      <th>类别名称</th>
                      <th>父类别id号</th>
                      <th>路径</th>
                      <th style="width: 100px">操作</th>
                    </tr>
                    @foreach($list as $v)
                    <tr>
                      <td>{{$v->id}}</td>
                      <td>{{$v->name}}</td>
                      <td>{{$v->pid}}</td>
                      <td>{{$v->path}}</td>
                      <td><button onclick="doDel({{$v->id}})" class="btn btn-xs btn-danger">删除</button>
                      <a href='{{url("admin/type")}}/{{$v->id}}/edit'><button class="btn btn-xs btn-primary">编辑</button></a></td>
                    </tr>
                    @endforeach
                  
                   
                  </table>
                </div><!-- /.box-body -->
                
              </div><!-- /.box -->

              
              
            </div><!-- /.col -->
            
          </div><!-- /.row -->
         
        </section><!-- /.content -->
        <form action="" style="display:none;" id="mydeleteform" method="post">
            <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
            <input type="hidden" name="_method" value="DELETE">
        </form>
    @endsection
    @section("myscript")
		<script type="text/javascript">
			
		function doDel(id){
			if(confirm('确定要删除吗？')){
				$("#mydeleteform").attr("action","{{url('admin/type')}}/"+id).submit(); 
			}
		}			
      </script>
    @endsection